import request from '@/utils/request'

export const getArticles = (page) => {
    return request.get('/article',{
        params:{
            page:page
        }
    })
}

export const getMyArticles = (obj) => {
    return request.get('/myArticle', {
        params: {
            uid:obj.uid,
            page: obj.page
        }
    })
}


export const search = (obj) => {
    return request.get('/search', {
        params: {
            keyWord:obj.key,
            page:obj.page
        }
    })
}


export const postArticles = (obj) => {
    return request.post('/article', {
         
            uid:obj.uid,
            title:obj.title,
            time:obj.time,
            introduce:obj.introduce,
            text:obj.text,
            mdText:obj.mdText
        
})
}


export const getDetail = (aId) => {
    return request.get('/aDetail', {
        params: {
            aId:aId
        }
    })
}


export const deleteArticle = (aId) => {
    return request.delete('/delete', {
        params: {
            aId: aId
        }
    })
}


export const edify = (obj) => {
    return request.post('/edify', {

        aId: obj.aId,
        title: obj.title,
        introduce: obj.introduce,
        text: obj.text,
        mdText: obj.mdText

    })
}